﻿@model KPIS.GERP.Models.ICM.Bid

@if (ViewContext.RouteData.Values["action"].ToString().ToLower() == "edit")
{
@Html.HiddenFor(model => model.BidId)
}
@Html.HiddenFor(model => model.PrId)
@Html.HiddenFor(model => model.ConfirmEmpId)
@Html.HiddenFor(model => model.RecordStatus)
@Html.HiddenFor(model => model.CreatedBy)
@Html.HiddenFor(model => model.CreatedWhen)
@Html.HiddenFor(model => model.UpdatedBy)
@Html.HiddenFor(model => model.UpdatedWhen)
@Html.Hidden("showApproveButton", ViewBag.showApproveButton == true ? true : false)

<div class="clearfix">
<div class="row-fluid">
    <h4 class="text-info">จัดทำประกาศ</h4>
</div>
<div class="row-fluid">
    <div class="control-group">
        <div class="control-label">
            วันที่จัดทำประกาศ
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.BidDate)
            @Html.ValidationMessageFor(model => model.BidDate)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            เลขที่เอกสารของประกาศ
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.Code)
            @Html.ValidationMessageFor(model => model.Code)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            ประกาศเรื่อง
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            วิธีจำหน่ายเอกสาร
        </div>
        <div class="controls">
            @Html.RadioButtonFor(m => m.ReceiveType, "F", new { onclick = "ReceiveTypeChange('F')" })<span class="lbl"> แจกฟรี</span>&nbsp;&nbsp;&nbsp;&nbsp;
            @Html.RadioButtonFor(m => m.ReceiveType, "S", new { onclick = "ReceiveTypeChange('S')" })<span class="lbl"> ขาย</span>&nbsp;&nbsp;
            <span id="divDocumentAmount">@Html.EditorFor(m => m.DocumentAmount, new { id = "txtDocumentAmount" }) บาท</span>
            @Html.ValidationMessageFor(model => model.ReceiveType)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            หมายเหตุ
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.Descr, "TextArea")
            @Html.ValidationMessageFor(model => model.Descr)
        </div>
    </div>

    <hr />

    <div class="alert alert-block alert-warning">
    <div class="control-group">
        <div class="control-label">
            กำหนดลงนามประกาศ
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.AnnounceDate)
            @Html.ValidationMessageFor(model => model.AnnounceDate)
        </div>
    </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            สถานที่รับ/จำหน่ายเอกสาร
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.ReceivePlace)
            @Html.ValidationMessageFor(model => model.ReceivePlace)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            กำหนดจำหน่ายเอกสาร
        </div>
        <div class="controls">
            <span class="input-icon input-icon-right">
                <input type="text" id="txtReceiveDate"><i class="icon-calendar"></i>
            </span>
            @Html.HiddenFor(m => m.ReceiveDateStart, new { id = "txtReceiveDateStart" })
            @Html.HiddenFor(m => m.ReceiveDateEnd, new { id = "txtReceiveDateEnd" })
            @Html.ValidationMessageFor(model => model.ReceiveDateStart)
            @Html.ValidationMessageFor(model => model.ReceiveDateEnd)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            ตั้งแต่เวลา
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.ReceiveTimeStart) ถึงเวลา 
            @Html.EditorFor(m => m.ReceiveTimeEnd)
            @Html.ValidationMessageFor(model => model.ReceiveDateStart)
            @Html.ValidationMessageFor(model => model.ReceiveDateEnd)
        </div>
    </div>
    <div class="alert alert-block alert-warning">
    <div class="control-group">
        <div class="control-label">
            (ถ้ามี) กำหนดดูสถานที่
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.BuildingDate)
            @Html.ValidationMessageFor(model => model.BuildingDate)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            ตั้งแต่เวลา
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.BuildingTimeStart) ถึงเวลา 
            @Html.EditorFor(m => m.BuildingTimeEnd)
            @Html.ValidationMessageFor(model => model.BuildingTimeStart)
            @Html.ValidationMessageFor(model => model.BuildingTimeEnd)
        </div>
    </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            (ถ้ามี) กำหนดชี้แจงรายละเอียด
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.ExplainDate)
            @Html.ValidationMessageFor(model => model.ExplainDate)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            ตั้งแต่เวลา
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.ExplainTime) เป็นต้นไป
            @Html.ValidationMessageFor(model => model.ExplainTime)
        </div>
    </div>
    <div class="alert alert-block alert-warning">
    <div class="control-group">
        <div class="control-label">
            สถานที่ยื่นเอกสาร
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.OfferPlace)
            @Html.ValidationMessageFor(model => model.OfferPlace)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            กำหนดยื่นเอกสาร
        </div>
        <div class="controls">
            <span class="input-icon input-icon-right">
                <input type="text" id="txtOfferDate"><i class="icon-calendar"></i>
            </span>
            @Html.HiddenFor(m => m.OfferDateStart, new { id = "txtOfferDateStart" })
            @Html.HiddenFor(m => m.OfferDateEnd, new { id = "txtOfferDateEnd" })
            @Html.ValidationMessageFor(model => model.OfferDateStart)
            @Html.ValidationMessageFor(model => model.OfferDateEnd)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            ตั้งแต่เวลา
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.OfferTimeStart) ถึงเวลา 
            @Html.EditorFor(m => m.OfferTimeEnd)
            @Html.ValidationMessageFor(model => model.OfferTimeStart)
            @Html.ValidationMessageFor(model => model.OfferTimeEnd)
        </div>
    </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            กำหนดเปิดซอง
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.DiscloseDate)
            @Html.ValidationMessageFor(model => model.DiscloseDate)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            ตั้งแต่เวลา
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.DiscloseTime) เป็นต้นไป
            @Html.ValidationMessageFor(model => model.DiscloseTime)
        </div>
    </div>

    <hr />
    @{
        var currentEmployee = GimsMembership.User != null ? GimsMembership.User.Employee : null;
    }
    <div class="control-group">
        <div class="control-label">
            ผู้จัดทำประกาศชื่อ
        </div>
        <div class="controls">
            @Html.HiddenFor(m => m.BidEmpId)
            @Html.DisplayFor(m => m.BidEmp.FullName)
            @if (Model.BidEmp == null && currentEmployee != null)
            {
                @currentEmployee.FullName
            }
            @Html.ValidationMessageFor(model => model.BidEmpId)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            สังกัด
        </div>
        <div class="controls">
            @Html.HiddenFor(m => m.BidJobSiteId)
            @Html.DisplayFor(m => m.BidJobSite.Name) 
            @Html.ValidationMessageFor(model => model.BidJobSiteId)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            ผู้ปิด/ปลดประกาศ
        </div>
        <div class="controls">
            @Html.DropDownListFor(m => m.CancelEmpId
                , new KPIS.GERP.WEB.GIMS.EmployeeService.EmployeeServiceClient().EmployeesSelectList(
                    new KPIS.GERP.Models.HRM.Employee()
                    {
                        RecordStatus = "!" + KPIS.GERP.Models.SYS.RecordStatus.DeletedStatus
                        , EmpTypeId = 1
                    }, true), new { @class = "chzn-select", id="ddlEmpId" })
            @Html.ValidationMessageFor(model => model.CancelEmpId)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            ปิดประกาศเมื่อ
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.ConfirmDate)
            @Html.ValidationMessageFor(model => model.ConfirmDate)
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            ปลดประกาศเมื่อ
        </div>
        <div class="controls">
            @Html.EditorFor(m => m.CancelDate)
            @Html.ValidationMessageFor(model => model.CancelDate)
        </div>
    </div>
</div>
</div>